package cn.xmkeshe.back.impl;

import cn.xmkeshe.back.IItemServiceBack;
import cn.xmkeshe.dao.IItemDao;
import cn.xmkeshe.model.Item;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class IItemServiceBackImpl implements IItemServiceBack {

  @Resource
  private IItemDao iItemDao;

  @Override
  @Transactional(propagation = Propagation.REQUIRED)
  public boolean add(Item item) {
    return iItemDao.doCreate(item);
  }

  @Override
  @Transactional(readOnly = true)
  public List<Item> findAll() {
    return iItemDao.findAll();
  }

  @Override
  public boolean editNote(String note, String iid) {
    return iItemDao.editNote(note,iid);
  }

  @Override
  @Transactional(propagation = Propagation.REQUIRED)
  public boolean delete(String iid) {
    return iItemDao.delete(iid);
  }
}
